<?php

class Python
{
    public $url = "https://www.lottery.com/jackpots/";
    public $html;

    public function __construct()
    {
        $this->html = file_get_contents($this->url);
    }

    //采集标签
    public function view()
    {
        $html = $this->html;
        //采集H4标签 h4
        preg_match_all('/<h4\sclass=\S?lottery-item-title\S?>(.*)<\/h4>/U', $html, $h4);
        $result[] = array_values($h4[1]);
        //获取H3标签h3
        preg_match_all('/(?i)<h3\sclass=\S?lottery-item-price\S?>(.*)<\/h3>/U', $html, $h3);
        $result[] = array_values($h3[1]);
        //时间戳date_time
        preg_match_all('/(?i)<div\s*class=\S?lottery-countdown\d?\S?\s*data-date=\S?\d+\-\d{2}\-\d{2}\w?\d{2}:\d{2}:\d{2}.\d*\w?\S>(.*)<\/div>/U',$html,$date_time);
        $result[] = array_values($date_time[0]);
        //剩下时间left_time
        preg_match_all('/(?i)<p\sclass=\S?lottery-item-windate\S?>(.*)<\/p>/U', $html, $left_time);
        //$result[] = array_values($left_time[1]);
        //获取H5标签内容h5
        preg_match_all('/(?i)<h5\sclass=\S?lottery-item-wintitle\S?>(.*)<\/h5>/U', $html, $h5);
        $result[] = array_values($h5[0]);
        //获取中奖时间winning
        preg_match_all('/(?i)<p\sclass=\S?lottery-item-winning\S?>(.*)<\/p>/U', $html, $winning);
        $result[] = array_values($winning[0]);
        //获取开奖号码lottery_num
        preg_match_all('/(?i)<div\s?class=\S?lottery-item-winnumbers\S?>\s*(<span\s?class=\S?lottery-number\s?lottery-number-\d*\S?>\d*<\/span>\s*)*<span\sclass=\S?bonus\s?lottery-number\s?lottery-number-\d*\S?>\d*<\/span>\s*<\/div>/', $html, $lottery_num);
        $result[] = array_values($lottery_num[0]);
        //力量播放play  array_values($play[1]);
        preg_match_all('/(?i)<p\sclass=\S?center\s*lotter-item-bonus\S?>(.*)<\/p>/U', $html, $play);
        $result[] = array_values($play[1]);
         //列表中奖游戏game_name
        preg_match_all('/<div\s*class=\"titleCol\">(.*)<\/div>/U', $html, $game_name);
        $result[] = array_values($game_name[1]);
        //列表开奖时间
        preg_match_all('/<div\s?class=\"dateCol\"><div>(.*)<\/div><\/div>/U', $html, $re);
        $result[] = array_values($re[1]);
        //中奖价格
        preg_match_all('/<div\s?class=\"jackpotCol\">\s*<span>(.*)<p>/U', $html, $price);
        $result[] = array_values($price[1]);
        //中奖小子
        preg_match_all('/<div\s?class=\"jackpotCol\">\s*<span>\s*\$\d*\S*\s*\w*<p>(.*)<\/p>/U', $html, $small);
        $result[] = array_values($small[1]);
        //列表中奖号码
        preg_match_all('/<div\s?class=\"lottery-item-winnumbers\">(.*)<\/div>/U', $html, $list_number);
        $result[] = array_values($list_number[1]);
        //list倍数
        preg_match_all('/<div\s?class=\"jackWinner\s*hiddenOnMobile\">(.*)<\/div>/U', $html, $multiple);
        $result[] = array_values($multiple[1]);
        return $result;
    }

   public function Leji(){
        $url="http://www.ffcapi.com/sys.php?id=xlj&t=4154dfs88a2&n=5&y=0&u=0";
        $html = file_get_contents($url);
    
        preg_match_all('/^20\d{10}/',$html,$periods);
        $arr[]=$periods;
        preg_match_all('/(?!=_)\d(?!=,)/U',$html,$number);
        $arr[]=$number;
        preg_match_all('/20\d{2}-\d{2}-\d{2}\s\d{2}:\d{2}:\d{2}/',$html,$re);
        $arr[]=$re;
        preg_match_all('/(?!-)\d{2}\-\d{2}\s/',$html,$date);
        $arr[]=$date;

        return $arr;
    }

    public function dog(){
        $url="http://www.ffcapi.com/sys.php?id=xddg&t=4154dfs88a2&n=5&y=0&u=0";
        $html = file_get_contents($url);
        preg_match_all('/^20\d{10}/',$html,$periods);
        $arr[]=$periods;
        preg_match_all('/(?!=_)\d(?!=,)/U',$html,$number);
        $arr[]=$number;
       preg_match_all('/20\d{2}-\d{2}-\d{2}\s\d{2}:\d{2}:\d{2}/',$html,$re);
        $arr[]=$re;
        return $arr;
    }

    public function lucky(){
        $url="http://www.ffcapi.com/sys.php?id=xxyxz&t=4154dfs88a2&n=5&y=0&u=0";
        $html = file_get_contents($url);
        preg_match_all('/^20\d{10}/',$html,$periods);
        $arr[]=$periods;
        preg_match_all('/(?!=_)\d{2}(?!=,)/U',$html,$number);
        $arr[]=$number;
        preg_match_all('/20\d{2}-\d{2}-\d{2}\s\d{2}:\d{2}:\d{2}/',$html,$re);
        $arr[]=$re;
        return $arr;
    }
    

}

$abc  = new Python();
$res  = $abc->view();
$leji = $abc->Leji();
$dog  = $abc->dog();
$lucky= $abc->lucky();
// print_r($dog);die;
// print_r($leji);die;
// print_r($res);die;
?>


<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>lottery</title>
    <link type="image/x-icon" rel='icon' href="images/favicon.ico">
    <link rel="stylesheet" type="text/css" href="font/iconfont.css">
    <link href="css/base.css" rel="stylesheet" type="text/css"/>
    <link href="font/iconfont.css" rel="stylesheet" type="text/css"/>
    <link href="css/animate.min.css" rel="stylesheet" type="text/css"/>
    <link href="css/head-footer.css" rel="stylesheet" type="text/css"/>
    <link href="css/master.css" rel="stylesheet" type="text/css"/>
    <link rel="stylesheet" href="css/1.css">
    <style type="text/css">
        
    </style>
</head>
<body >
<div class="head_wrap">
    <div class="head_content clearfix">
        <div class="logo"></div>
        <ul class="nav clearfix">
            <li><a href="home.php">HOME</a></li>
            <li><a href="results.html">RESULTS</a></li>
            <li><a href="jackpots.html">JACKPOTS</a></li>
        </ul>
    </div>
</div>
<div class="poster_box poster_bg">
    <div class="poster_container animated bounceInLeft">
        <h1>Play the lottery on your phone!</h1>
        <div class="sectionInfo">
            <p style="text-align: center; font-size: 18px;">Track your tickets, get alerts when you win, and play on the
                go.</p>
            <form id="jot-subscriber-form-1" action="" method="post">
                <input name="jot-group-id" type="hidden" value="1">
                <input name="jot_form_id" type="hidden" value="jot-subscriber-form">
                <input id="jot-form-special" class="jot-special" name="jot-form-special" type="hidden" value="">
                <input id="jot-verified-number" name="jot-verified-number" type="hidden" value="">
                <input id="jot-subscribe-name" name="jot-subscribe-name" type="hidden" value="No name given">
                <input id="jot-subscribe-num" maxlength="200" name="jot-subscribe-num" size="40" type="hidden"
                       placeholder="555-555-5555">
                <input type="tel" placeholder="555-555-5555" class="customTelNumber">
                <input id="jot-subscribegroup-button" data-jot="footerSub" class="button jot-subscribegroup-button"
                       type="button" value="GET THE APP"
                       onclick="return alert('This feature is being developed......')">
                <div id="jot-subscribemessage" data-jot="footerSub"></div>
            </form>
        </div>
    </div>
    <div class="game_info_box clearfix"  >
        <ul class=" clearfix animated fadeInUp">
            <?php for ($i = 0; $i < 2; $i++) { ?>
                <li style="overflow:hidden">
                    <h2><?php echo @$res[0][$i] ?></h2>
                    <h1><?php echo @$res[1][$i] ?></h1>
                    <div class="lottery-item-countDate">
                        <?php echo @$res[2][$i] ?>
                    </div>
                    <p>until next draw</p>
                    <div class="lottery-item-windate"> <?php echo @$res[4][$i] ?> </div>
                    <div class="number_box number_hold06">
                        <?php echo @$res[5][$i] ?>
                    </div>
                   
                </li>
            <?php 
        } ?>


<!-- 网络数据 -->
<li>
                    <h2><?php echo @$res[0][3] ?></h2>
                    <h1><?php echo @$res[1][3] ?></h1>
                    <div class="lottery-item-countDate">
                        <?php echo @$res[2][3] ?>
                    </div>
                    <p>until next draw</p>
                    <div class="lottery-item-windate"> <?php echo @$res[4][3] ?> </div>
                    <div class="number_box number_hold06">
                        <?php echo $res[5][3] ?>
                    </div>
                   
                </li>

<!-- 1 -->
            <li>
                <h2>LEJI</h2>
                <h1>winning number</h1>

                <div class="lottery-item-countDate"  id="one">

        <div class="lottery-countdown" data-date="<?php echo @$leji[2][0][0]?>">
             <span>17</span>:<span>31</span>:<span>26</span></div>

                </div>

                <p>TIME LEFT</p>
                <div class="lottery-item-windate"><?php echo @$leji[0][0][0]?> phase</div>
                <div class="number_box number_hold06">
                <span><?php echo @$leji[1][0][12] ?></span>
                <span><?php echo @$leji[1][0][13] ?></span>
                <span><?php echo @$leji[1][0][14] ?></span>
                <span><?php echo @$leji[1][0][15] ?></span>
                <span class="bonus"><?php echo @$leji[1][0][16] ?></span>
                </div>
         
            </li>
 <!-- 2            -->
            <li>
                <h2>ELECTRIC DOG</h2>
                <h1>winning number</h1>

                <div class="lottery-item-countDate" id="tow">
                <div class="lottery-countdown" data-date="<?php echo @$dog[2][0][0]?>">
             <span>17</span>:<span>31</span>:<span>26</span></div>

                </div>

                <p>TIME LEFT</p>
                <div class="lottery-item-windate"><?php echo @$dog[0][0][0]?> phase</div>
                <div class="number_box number_hold06">
                <span><?php echo @$dog[1][0][12] ?></span>
                <span><?php echo @$dog[1][0][13] ?></span>
                <span><?php echo @$dog[1][0][14] ?></span>
                <span><?php echo @$dog[1][0][15] ?></span>
                <span><?php echo @$dog[1][0][16] ?></span>
                <span><?php echo @$dog[1][0][17] ?></span>
                <span><?php echo @$dog[1][0][18] ?></span>
                <span class="bonus"><?php echo @$dog[1][0][19] ?></span>
                </div>
         
            </li>

            <li>
                <h2>LUCKY CONSTELLATION</h2>
                <h1>winning number</h1>
                <div class="lottery-item-countDate" id="three">
                <div class="lottery-countdown" data-date="<?php echo @$lucky[2][0][0]?>">
             <span>17</span>:<span>31</span>:<span>26</span></div>

                </div>

                <p>TIME LEFT</p>
                <div class="lottery-item-windate"><?php echo @$lucky[0][0][0]?> phase</div>
                <div class="number_box number_hold06">
                <span><?php echo @$lucky[1][0][6] ?></span>
                <span><?php echo @$lucky[1][0][7] ?></span>
                <span><?php echo @$lucky[1][0][8] ?></span>
                <span><?php echo @$lucky[1][0][9] ?></span>
                <span><?php echo @$lucky[1][0][10] ?></span>
                <span><?php echo @$lucky[1][0][11] ?></span>
                <span class="bonus"><?php echo @$lucky[1][0][12] ?></span>
                </div>
         
            </li>
        </ul>
        <div class="cooperate_box pr">
            <a class="w55" target="_blank"
               href="https://www.cnbc.com/2017/07/10/a-mobile-powerball-app-wants-to-help-millennials-buy-lottery-tickets.html"></a>
            <a class="w80" target="_blank"
               href="https://techcrunch.com/2016/06/07/autolotto-launches-its-mobile-powerball-app/"></a>
            <a class="w88" target="_blank"
               href="http://blogs.wsj.com/venturecapital/2015/11/02/the-daily-startup-diagnostic-imaging-startups-set-for-record-fundraising/"></a>
            <a class="w105" target="_blank"
               href="https://www.forbes.com/sites/causeintegration/2015/12/14/how-one-startup-is-making-the-lottery-cool-and-causey/#16a5ab56bd90"></a>
            <a class="w135" target="_blank" href="http://fortune.com/2017/07/11/term-sheet-tuesday-july-11/"></a>
            <a class="w152" target="_blank"
               href="http://www.reuters.com/article/brief-autolotto-raises-17-million-in-ser-idUSASA09WIW"></a>
            <a class="w148" target="_blank"
               href="http://www.huffingtonpost.com/ryan-scott/how-one-startup-is-making_b_8808592.html"></a>
            <a class="w112" target="_blank"
               href="https://finance.yahoo.com/news/mobile-powerball-app-wants-help-152502338.html"></a>
            <a class="w80" target="_blank"
               href="http://venturebeat.com/2015/10/30/here-are-the-34-companies-that-presented-at-500-startups-batch-14-demo-day/"></a>
        </div>
    </div>
</div>
<div class="list_box">
    <div class="list_contents">
        <ul class="mainFilter clearfix">
            <li class="pr drop_show01">
                <ul class="drop_down_box">


                    <li><a href="">Arizona</a></li>
                    <li><a href="">Arkansas</a></li>
                    <li><a href="">California</a></li>
                    <li><a href="">Colorado</a></li>
                    <li><a href="">Connecticut</a></li>
                    <li><a href="">Delaware</a></li>
                    <li><a href="">District Of Columbia</a></li>
                    <li><a href="">Florida</a></li>
                    <li><a href="">Georgia</a></li>
                    <li><a href="">Idaho</a></li>
                    <li><a href="">Illinois</a></li>
                    <li><a href="">Indiana</a></li>
                    <li><a href="">Iowa</a></li>
                    <li><a href="">Kansas</a></li>
                    <li><a href="">Kentucky</a></li>
                    <li><a href="">Louisiana</a></li>
                    <li><a href="">Maine</a></li>
                    <li><a href="">Maryland</a></li>
                    <li><a href="">Massachusetts</a></li>
                    <li><a href="">Michigan</a></li>
                    <li><a href="">Minnesota</a></li>
                    <li><a href="">Missouri</a></li>
                    <li><a href="">Montana</a></li>
                    <li><a href="">Nebraska</a></li>
                    <li><a href="">New Hampshire</a></li>
                    <li><a href="">New Jersey</a></li>
                    <li><a href="">New Mexico</a></li>
                    <li><a href="">New York</a></li>
                    <li><a href="">North Carolina</a></li>
                    <li><a href="">North Dakota</a></li>
                    <li><a href="">Ohio</a></li>
                    <li><a href="">Oklahoma</a></li>
                    <li><a href="">Oregon</a></li>
                    <li><a href="">Pennsylvania</a></li>
                    <li><a href="">Puerto Rico</a></li>
                    <li><a href="">Rhode Island</a></li>
                    <li><a href="">South Carolina</a></li>
                    <li><a href="">South Dakota</a></li>
                    <li><a href="">Tennessee</a></li>
                    <li><a href="">Texas</a></li>
                    <li><a href="">Vermont</a></li>
                    <li><a href="">Virgin Islands</a></li>
                    <li><a href="">Virginia</a></li>
                    <li><a href="">Washington</a></li>
                    <li><a href="">West Virginia</a></li>
                    <li><a href="">Wisconsin</a></li>
                    <li><a href="">Wyoming</a></li>
            
                </ul>
                <div class="filter_title pr">
                    <span>LOCATION</span>
                    <H3 class="state">US </H3><i class="iconfont icon-z-arrowDown down_icon"></i>
                </div>
            </li>
            <li class="pr drop_show02">
                <ul class="drop_down_box">
                    <li><a href="">Powerball</a></li>
                    <li><a href="">MEGA Millions</a></li>
                    <li
                    ><a href="">Hot Lotto</a></li>
                    <li><a href="">Lucky For Life</a></li>
                    <li><a href="">Cash4Life</a></li>
                </ul>
                <div class="filter_title pr">
                    <span>GAME</span>
                    <H3 class="game_name">ALL GAMES </H3><i class="iconfont icon-z-arrowDown down_icon"></i>
                </div>
            </li>
        </ul>
        <div class="game_list clearfix">
            <div class="list_heading clearfix">
                <span class="w285">GAME</span>
                <span class="w190">DRAW DATE</span>
                <span class="w285">JACKPOT</span>
                <span class="w377">RESULTS</span>
            </div>
            <ul class="list_row clearfix">
                <?php for ($j = 0; $j < 2; $j++) { ?>
                <li >
                <a href="#">
                        <span class="w285"><?php echo @$res[7][$j] ?></span>
                    <span class="w190">
                        <div class="date_box">
                            <div class="top_block"></div>
                            <div class="date_number"><?php echo @$res[8][$j] ?></div>
                        </div>
                    </span>
                    <span class="w287">
                        <div class="inside_box">
                            <h2><?php echo @$res[9][$j] ?></h2>
                            <p><?php echo @$res[10][$j] ?></p>
                        </div>
                    </span>
                    <span class="w377">
                    <div class="inside_box">
                            <ul class="clearfix">
                                <?php echo @$res[11][$j] ?>
                            </ul>
                            <p><?php echo @$res[12][$j] ?></p>
                        </div>

                    </span>
                        <span><i class="iconfont icon-jiantou"></i></span>
                    </a>
                </li>
                <?php 
            } ?>

  <!-- 网络数据  1        -->
                <li >
                <a href="#">
                        <span class="w285"><?php echo @$res[7][3] ?></span>
                    <span class="w190">
                        <div class="date_box">
                            <div class="top_block"></div>
                            <div class="date_number"><?php echo @$res[8][3] ?></div>
                        </div>
                    </span>
                    <span class="w287">
                        <div class="inside_box">
                            <h2><?php echo @$res[9][3] ?></h2>
                            <p><?php echo @$res[10][3] ?></p>
                        </div>
                    </span>
                    <span class="w377">
                    <div class="inside_box">
                            <ul class="clearfix">
                                <?php echo @$res[11][3] ?>
                            </ul>
                            <p><?php echo @$res[12][3] ?></p>
                        </div>

                    </span>
                        <span><i class="iconfont icon-jiantou"></i></span>
                    </a>
                </li>

<!-- leji -->
<li >
                <a href="#">
                        <span class="w285">LEJI</span>
                    <span class="w190">
                        <div class="date_box">
                            <div class="top_block"></div>

                    <div class="date_number"><?php echo @$leji[3][0][0] ?></div>

                        </div>
                    </span>
                    <span class="w287">
                        <div class="inside_box">
                            <!--乐基奖金数额预留  -->
                            <h2>$--,--</h2>
        
                        </div>
                    </span>
                    <span class="w377">
                    <div class="inside_box">
                            <ul class="clearfix">
                            
                <span><?php echo @$leji[1][0][12] ?></span>
                <span><?php echo @$leji[1][0][13] ?></span>
                <span><?php echo @$leji[1][0][14] ?></span>
                <span><?php echo @$leji[1][0][15] ?></span>
                <span class="bonus"><?php echo @$leji[1][0][16] ?></span>
                            </ul>
                            <p></p>
                        </div>

                    </span>
                        <span><i class="iconfont icon-jiantou"></i></span>
                    </a>
                </li>
<!-- DOG -->
<li >
                <a href="#">
                        <span class="w285">ELECTRIC DOG</span>
                    <span class="w190">
                        <div class="date_box">
                            <div class="top_block"></div>
                            <div class="date_number"><?php echo @$leji[3][0][0] ?></div>
                        </div>
                    </span>
                    <span class="w287">
                        <div class="inside_box">
                            <!--dog奖金数额预留  -->
                            <h2>$--,--</h2>
       
                        </div>
                    </span>
                    <span class="w377">
                    <div class="inside_box">
                            <ul class="clearfix">
                <span><?php echo @$dog[1][0][12] ?></span>
                <span><?php echo @$dog[1][0][13] ?></span>
                <span><?php echo @$dog[1][0][14] ?></span>
                <span><?php echo @$dog[1][0][15] ?></span>
                <span><?php echo @$dog[1][0][16] ?></span>
                <span><?php echo @$dog[1][0][17] ?></span>
                <span><?php echo @$dog[1][0][18] ?></span>
                <span class="bonus"><?php echo @$dog[1][0][19] ?></span>
                            </ul>
                            <p></p>
                        </div>

                    </span>
                        <span><i class="iconfont icon-jiantou"></i></span>
                    </a>
                </li>
<!-- Lucky -->
<li >
                <a href="#">
                        <span class="w285">LUCKY CONSTELLATION</span>
                    <span class="w190">
                        <div class="date_box">
                            <div class="top_block"></div>
                            <div class="date_number"><?php echo @$leji[3][0][0] ?></div>
                        </div>
                    </span>
                    <span class="w287">
                        <div class="inside_box">
                            <h2>$--,--</h2>
                   
                        </div>
                    </span>
                    <span class="w377">
                    <div class="inside_box">
                            <ul class="clearfix">
                <span><?php echo @$lucky[1][0][6] ?></span>
                <span><?php echo @$lucky[1][0][7] ?></span>
                <span><?php echo @$lucky[1][0][8] ?></span>
                <span><?php echo @$lucky[1][0][9] ?></span>
                <span><?php echo @$lucky[1][0][10] ?></span>
                <span><?php echo @$lucky[1][0][11] ?></span>
                <span class="bonus"><?php echo @$lucky[1][0][12] ?></span>
                            </ul>
                            <p></p>
                        </div>

                    </span>
                        <span><i class="iconfont icon-jiantou"></i></span>
                    </a>
                </li>
            </ul>
        </div>
    </div>

</div>
<div class="footer">
    <div class="container clearfix">
        <ul>
            <li class="clearfix">
                <h3>MORE INFO</h3>
                <a href="contact-us.html">Lottery Association Inquiries</a>
                <a href="questions.html">Frequently Asked Questions</a>
                <a href="contact-us.html">Contact Us</a>
            </li>
            <li class="clearfix">
                <h3>LEGAL</h3>
                <a href="Service.html">Terms of Service</a>
                <a href="policy.html">Privacy Policy</a>
                <a href="game_policy.html">Responsible Gaming Policy</a>
                <a href="beware.html">Beware of Scamsy</a>
            </li>
            <li class="clearfix">
                <p><span>Information on responsible gaming and problem gaming is available </span><a href="here.html">here</a><span> .Or call 1-800-522-4700.</span>
                </p>
            </li>
        </ul>
    </div>
</div>
<script src="http://cdn.static.runoob.com/libs/jquery/2.1.1/jquery.min.js"></script>
</body>
<script language="javascript" type="text/javascript">  
/**js*
     * 点击时间 属性
     */

    $(".drop_down_box li").children().removeAttr("href"); 

var endtime,nowtime,lefttime,d,h,m,s;
var sh;
$.fn.countDown = function(_boolean,_this){

    var sh = [];
    // var _this = $(this);
    _this.each(function(index, el){

    var thisObj = $(this).children();
    sh[index]=setInterval(function(){
        var times = thisObj.data("date");//获得的data值，即结束时间
        endtime = new Date(times);//把data值转换成时间
        nowtime = new Date();//获得当前时间
        lefttime=parseInt((endtime.getTime()-nowtime.getTime())/1000); //结束时间-当前时间得到毫秒数，再除以1000得到两个时间相差的秒数

        h=parseInt(lefttime/3600);
        m=parseInt((lefttime/60)%60);
        s=parseInt(lefttime%60);
        if(endtime.getTime() <= nowtime.getTime()){
            h = m = s = "0";
            clearInterval(sh[index]);
        }
        // 三目运算符
       
        h = h < 10 ? "0"+ h : h;
        m = m < 10 ? "0"+ m : m;
        s = s < 10 ? "0"+ s : s;
        
        thisObj.children().eq(0).text(h);
        thisObj.children().eq(1).text(m);
        thisObj.children().eq(2).text(s);
      
        if(lefttime<=0){
            h = m = s = "00";
            clearInterval(sh[index]);
        }
    },1000);
    });
}
// 调用
$(".lottery-item-countDate").countDown(true,$(".lottery-item-countDate"));

//js

 
</script>
</html>